package component

type Resp struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Explain string      `json:"explain"`
	Data    interface{} `json:"data"`
}

func NewRes() *Resp {
	return &Resp{
		Code:    0,
		Msg:     "success",
		Explain: "success",
		Data:    nil,
	}
}

func (r *Resp) SetCode(code int) *Resp {
	r.Code = code
	return r
}

func (r *Resp) SetMsg(msg string) *Resp {
	r.Msg = msg
	return r
}

func (r *Resp) SetExplain(Explain string) *Resp {
	r.Explain = Explain
	return r
}

func (r *Resp) SetData(Data interface{}) *Resp {
	r.Data = Data
	return r
}
